/*This file is part of Sandbox.

Sandbox is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License.

Sandbox is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Sandbox.  If not, see <http://www.gnu.org/licenses/>.

For contact, see the About page of my blog: <http://mygeekyware.wordpress.com/>.*/

#include <iostream>
#include "dibujar.h"
#include "particula.h"
#include <SDL/SDL.h>
#include <SDL/SDL_events.h>
#include <SDL/SDL_ttf.h>
#include "controlador.h"
#include "definiciones.h"

using namespace std;

SDL_Color color;
SDL_Surface *text;
SDL_Rect rect;
char cadena[30];


void dibujarmenu(TTF_Font *font, SDL_Surface **screen, controlador *contr) {
    dibujarseleccionado(screen, contr);
    //Left menu first because of being smaller
    //QUIT
    color = (SDL_Color) {150,150,150,255};
    text = TTF_RenderText_Solid(font, "QUIT", color);
    rect = (SDL_Rect) {712,584,88,13};
    SDL_BlitSurface(text, NULL, *screen, &rect);
    SDL_FreeSurface(text);
    //Reset
    color = (SDL_Color) {150,150,150,255};
    text = TTF_RenderText_Solid(font, "RESET", color);
    rect = (SDL_Rect) {712,571,88,13};
    SDL_BlitSurface(text, NULL, *screen, &rect);
    SDL_FreeSurface(text);
    //Change brush size
    color = (SDL_Color) {150,150,150,255};
    sprintf(cadena, "- BRUSH SIZE + %i", contr->brsize);
    text = TTF_RenderText_Solid(font, cadena, color);
    rect = (SDL_Rect) {712,558,88,13};
    SDL_BlitSurface(text, NULL, *screen, &rect);
    SDL_FreeSurface(text);
    //Change simulation speed
    color = (SDL_Color) {150,150,150,255};
    sprintf(cadena, "- SPEED + %i", contr->speed);
    text = TTF_RenderText_Solid(font, cadena, color);
    rect = (SDL_Rect) {712,545, 88,13};
    SDL_BlitSurface(text, NULL, *screen, &rect);
    SDL_FreeSurface(text);

    //Time for right menu
    //Clear
    color = (SDL_Color) {150,150,150,255};
    text = TTF_RenderText_Solid(font, "CLEAR", color);
    rect = (SDL_Rect) {5,441,88,13};
    SDL_BlitSurface(text, NULL, *screen, &rect);
    SDL_FreeSurface(text);
    //Wall
    color = (SDL_Color) {150,150,150,255};
    text = TTF_RenderText_Solid(font, "WALL", color);
    rect = (SDL_Rect) {5,454,88,13};
    SDL_BlitSurface(text, NULL, *screen, &rect);
    SDL_FreeSurface(text);
    //Agua
    color = (SDL_Color) {30,30,255,255};
    text = TTF_RenderText_Solid(font, "WATER", color);
    rect = (SDL_Rect) {5,467,88,13};
    SDL_BlitSurface(text, NULL, *screen, &rect);
    SDL_FreeSurface(text);
    //Sal
    color = (SDL_Color) {255,255,255,255};
    text = TTF_RenderText_Solid(font, "SALT", color);
    rect = (SDL_Rect) {5,480,88,13};
    SDL_BlitSurface(text, NULL, *screen, &rect);
    SDL_FreeSurface(text);
    //Arena
    color = (SDL_Color) {255,204,75,255};
    text = TTF_RenderText_Solid(font, "SAND", color);
    rect = (SDL_Rect) {5,493,88,13};
    SDL_BlitSurface(text, NULL, *screen, &rect);
    SDL_FreeSurface(text);
    //Fuego
    color = (SDL_Color) {255,0,0,255};
    text = TTF_RenderText_Solid(font, "FIRE", color);
    rect = (SDL_Rect) {5,506,88,13};
    SDL_BlitSurface(text, NULL, *screen, &rect);
    SDL_FreeSurface(text);
    //Salt Water
    color = (SDL_Color) {70,70,255,255};
    text = TTF_RenderText_Solid(font, "SALT WATER", color);
    rect = (SDL_Rect) {5,519, 88,13};
    SDL_BlitSurface(text, NULL, *screen, &rect);
    SDL_FreeSurface(text);
    //Stone
    color = (SDL_Color) {180,180,180,255};
    text = TTF_RenderText_Solid(font, "STONE", color);
    rect = (SDL_Rect) {5,532,88,13};
    SDL_BlitSurface(text, NULL, *screen, &rect);
    SDL_FreeSurface(text);
    //Earth
    color = (SDL_Color) {139,41,0,255};
    text = TTF_RenderText_Solid(font, "EARTH", color);
    rect = (SDL_Rect) {5,545,88,13};
    SDL_BlitSurface(text, NULL, *screen, &rect);
    SDL_FreeSurface(text);
    //Ice
    color = (SDL_Color) {255,255,255,255};
    text = TTF_RenderText_Solid(font, "ICE", color);
    rect = (SDL_Rect) {5,558,88,13};
    SDL_BlitSurface(text, NULL, *screen, &rect);
    SDL_FreeSurface(text);
    //Magma
    color = (SDL_Color) {210,0,0,255};
    text = TTF_RenderText_Solid(font, "MAGMA", color);
    rect = (SDL_Rect) {5,571,88,13};
    SDL_BlitSurface(text, NULL, *screen, &rect);
    SDL_FreeSurface(text);
    //Firework
    color = (SDL_Color) {255,255,0,255};
    text = TTF_RenderText_Solid(font, "FIREWORK", color);
    rect = (SDL_Rect) {5,584,88,13};
    SDL_BlitSurface(text, NULL, *screen, &rect);
    SDL_FreeSurface(text);
    //Torch
    color = (SDL_Color) {139,41,0,255};
    text = TTF_RenderText_Solid(font, "TORCH", color);
    rect = (SDL_Rect) {93,441,88,13};
    SDL_BlitSurface(text, NULL, *screen, &rect);
    SDL_FreeSurface(text);
    //Bomb
    color = (SDL_Color) {52,89,0,255};
    text = TTF_RenderText_Solid(font, "BOMB", color);
    rect = (SDL_Rect) {93,454,88,13};
    SDL_BlitSurface(text, NULL, *screen, &rect);
    SDL_FreeSurface(text);
    //Fuse
    color = (SDL_Color) {149,66,0,255};
    text = TTF_RenderText_Solid(font, "FUSE", color);
    rect = (SDL_Rect) {93,467,88,13};
    SDL_BlitSurface(text, NULL, *screen, &rect);
    SDL_FreeSurface(text);
    //OIL
    color = (SDL_Color) {145,43,0,255};
    text = TTF_RenderText_Solid(font, "OIL", color);
    rect = (SDL_Rect) {93,480,88,13};
    SDL_BlitSurface(text, NULL, *screen, &rect);
    SDL_FreeSurface(text);
}